﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		BackOfficeControllerBase.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 // 
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System;
using Dexter.Logger.Contracts;
using Dexter.Services;
using Dexter.Web.Mvc.ViewModel.ViewsData;
using Dexter.Web.Mvc.ViewsData;
using Dexter.Web.Utils;

namespace Dexter.Web.Mvc.Controllers {
	
	public class BackOfficeControllerBase : DexterControllerBase {
		protected IContactService ContactService;

		public BackOfficeControllerBase ( IConfigurationService configurationService , IWebUtils webUtils , ILogger logger , IUrlBuilder urlBuilder , IContactService contactService ) : base ( configurationService , webUtils , logger , urlBuilder ) {
			this.ContactService = contactService;
		}

		protected T GetViewData<T> ( T instance ) where T : BackOfficeBaseViewData {
			if(instance == null)
				throw new ArgumentNullException ( );

			instance.LastMessages = ContactService.GetList ( 0 , 50 );

			return instance;
		}
	}
}
